1. /* slmsetsd.cpp by K.Tsuru */
  2. // function ID = 203 DRADIX
  3. /********************************************************************
  4. SLong class
  5. an auxiliary function for
  6. SLong& SLong::operator=(const SDouble& sr);
  7. When the exponent has a large number it takes effective figures only.
  8. It does not round up the hidden figures.
  9. **********************************************************************/
  10. #ifndef SN_H
  11. #include "sn.h"
  12. #endif
  13. void SLong::SetSDouble(const SDouble& sr){
  14. int e = sr.NetRdxExp();
  15. if(e <= 0){ // sr = 0 || sr < 1.0;
  16. // 0.9999 9999 9999 .... ===> zero
  17. SNumber::SetZero();
  18. return;
  19. }
  20. SDouble t(sr);
  21. t.StdReform(203);
  22. e = t.RdxExp();
  23. #ifndef NDEBUG
  24. assert(e > 0);
  25. #endif
  26. uint H = (uint)e, last = min(t.Head(), t.EffFig()); // ver. 2.17 SDHead() --> Head()
  27. valloc(H, 0);
  28. register uint j;
  29. for(j = 1; j <= last && e > 0 ; j++, e--) figure[H-j] = t.figure(j);
  30. SetSign(sr.Sign());
  31. CheckArray(203);
  32. }

slmsetsd.cpp : last modifiled at 2015/11/27 14:19:12(967 bytes)
created at 2017/10/07 10:26:50
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).